<?php

namespace app\api\controller;

use app\api\annotation\LoginRequired;
use app\api\basic\BaseController;
use support\Request;
use app\space\logic\findSpaceLogic;

class FindSpaceController extends BaseController {
     protected $userInfo;

    /**
     * 当前登陆管理员ID
     */
    protected $userId;

    /**
     * 当前登陆管理员账号
     */
    protected $userName;
    public function __construct()
    {   
        parent::__construct();
        $this->userId=request()->userId;
        $this->userName=request()->userName;
        $this->userInfo=request()->userInfo;
    }

    #[LoginRequired(required:false)]
    public function lists(Request $request){
        $param = $request->more([
            ['lang_code','zh']
        ]);
        $activity=new  findSpaceLogic();
        $data=$activity->search(['lang_code'=>$param['lang_code']])
        ->field('space_title,space_image,vr_link')
        ->order('sort_order desc,create_time desc')
        ->select();
        if($data){
              return $this->success($data->toArray());
        }
        return $this->success([]);
    }
    
}